home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10743 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  970 b 

  1. Path: news.intellinet.com!usenet
  2. From: JerryD@prodentec.com (Jerry Davis)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: operator % - compiler error
  5. Date: Tue, 19 Mar 1996 20:05:18 GMT
  6. Organization: IntelliNet-ISP, LLC. 1-800-290-7677
  7. Message-ID: <4in0ih$o43@zeus.intellinet.com>
  8. References: <4ihuuh$6ul@hatathli.csulb.edu>
  9. NNTP-Posting-Host: 204.214.231.27
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. davidcho@csulb.edu (David Cho) wrote:
  13.  
  14. >When I try to compile, I get an erro message for the following line:        
  15.  
  16.  
  17. >x=663608941*y%pow(2,32)  /*I want remainder*/
  18.  
  19. >But the error message says "illegal use of floating point".  What does 
  20. >that mean?  Isn't % used a an operator to calcuate the remainder?
  21.  
  22. In Microsoft and Borland, the pow() function takes two doubles and
  23. returns a double.  The % operator can't take a double in either
  24. argument, thus causing the error.  Try casting it like such:
  25. x=663608941*y%(long)pow(2,32);
  26.  
  27. Jerry Davis
  28. jerryd@intellinet.com
  29. jerryd@prodentec.com
  30.  
  31.  
  32.